Add content model to prop=info
authorumherirrender <umherirrender_de.wp@web.de>
Wed, 8 May 2013 18:08:40 +0000 (20:08 +0200)
committerumherirrender <umherirrender_de.wp@web.de>
Wed, 8 May 2013 18:08:40 +0000 (20:08 +0200)
Fields of page table are shown by default in prop=info

Change-Id: Id8b90c341dea19337558ed355975ab890f0663e2

RELEASE-NOTES-1.22
includes/api/ApiQueryInfo.php

index d13c825..fdff848 100644 (file)
@@ -108,6 +108,7 @@ production.
   stored in the database.
 * (bug 47219) Allow specifying change type of Wikipedia feed items
 * prop=imageinfo now allows setting iiurlheight without setting iiurlwidth
+* prop=info now adds the content model of the title.
 
 === Languages updated in 1.22===
 
index 6dbda5f..787057d 100644 (file)
@@ -56,7 +56,7 @@ class ApiQueryInfo extends ApiQueryBase {
         * @return void
         */
        public function requestExtraData( $pageSet ) {
-               global $wgDisableCounters;
+               global $wgDisableCounters, $wgContentHandlerUseDB;
 
                $pageSet->requestField( 'page_restrictions' );
                // when resolving redirects, no page will have this field
@@ -70,6 +70,9 @@ class ApiQueryInfo extends ApiQueryBase {
                $pageSet->requestField( 'page_touched' );
                $pageSet->requestField( 'page_latest' );
                $pageSet->requestField( 'page_len' );
+               if ( $wgContentHandlerUseDB ) {
+                       $pageSet->requestField( 'page_content_model' );
+               }
        }
 
        /**
@@ -348,6 +351,9 @@ class ApiQueryInfo extends ApiQueryBase {
                $titleExists = $pageid > 0; //$title->exists() needs pageid, which is not set for all title objects
                $ns = $title->getNamespace();
                $dbkey = $title->getDBkey();
+
+               $pageInfo['contentmodel'] = $title->getContentModel();
+
                if ( $titleExists ) {
                        global $wgDisableCounters;
 
@@ -819,7 +825,8 @@ class ApiQueryInfo extends ApiQueryBase {
                                'starttimestamp' => array(
                                        ApiBase::PROP_TYPE => 'timestamp',
                                        ApiBase::PROP_NULLABLE => true
-                               )
+                               ),
+                               'contentmodel' => 'string',
                        ),
                        'watched' => array(
                                'watched' => 'boolean'